        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>Matrix33 class / box2d_html Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="../styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="../favicon.ico">
        
        </head>
        <body data-library="box2d_html" data-type="Matrix33">
        <div class="page">
        <div class="header">
          <a href="../index.html"><div class="logo"></div></a>
          <a href="../index.html">Dart Documentation</a>
         &rsaquo; <a href="../box2d_html.html">box2d_html</a> &rsaquo; <a href="../box2d_html/Matrix33.html">Matrix33</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
        <h2><strong>Matrix33</strong>
          class
        </h2>
        
<button id="show-inherited" class="show-inherited">Hide inherited</button>
<div class="doc">
<p>A 3-by-3 matrix. Stored in column-major order.</p>
<pre class="source">
class Matrix33 {
  final Vector3 col1;
  final Vector3 col2;
  final Vector3 col3;

  Matrix33() :
    col1 = new Vector3(),
    col2 = new Vector3(),
    col3 = new Vector3() { }

  Matrix33.setCols(Vector3 argCol1, Vector3 argCol2, Vector3 argCol3) :
    col1 = new Vector3.copy(argCol1),
    col2 = new Vector3.copy(argCol2),
    col3 = new Vector3.copy(argCol3) { }

  void setZero() {
    col1.setZero();
    col2.setZero();
    col3.setZero();
  }

  // Multiply a matrix times a vector.
  static Vector3 mul(Matrix33 A, Vector3 v){
    return new Vector3(v.x * A.col1.x + v.y * A.col2.x + v.z + A.col3.x,
        v.x * A.col1.y + v.y * A.col2.y + v.z * A.col3.y,
        v.x * A.col1.z + v.y * A.col2.z + v.z * A.col3.z);
  }

  static void mulToOut(Matrix33 A, Vector3 v, Vector3 out){
    final num tempy = v.x * A.col1.y + v.y * A.col2.y + v.z * A.col3.y;
    final num tempz = v.x * A.col1.z + v.y * A.col2.z + v.z * A.col3.z;
    out.x = v.x * A.col1.x + v.y * A.col2.x + v.z + A.col3.x;
    out.y = tempy;
    out.z = tempz;
  }

  /**
   * Solve A * x = b, where b is a column vector. This is more efficient
   * than computing the inverse in one-shot cases.
   */
  Vector solve22(Vector b) {
    Vector x = new Vector();
    solve22ToOut(b, x);
    return x;
  }

  /**
   * Solve A * x = b, where b is a column vector. This is more efficient
   * than computing the inverse in one-shot cases.
   */
  void solve22ToOut(Vector b, Vector out) {
    final num a11 = col1.x, a12 = col2.x, a21 = col1.y, a22 = col2.y;
    num det = a11 * a22 - a12 * a21;
    if (det != 0.0){
      det = 1.0 / det;
    }
    out.x = det * (a22 * b.x - a12 * b.y);
    out.y = det * (a11 * b.y - a21 * b.x);
  }

  /**
   * Solve A * x = b, where b is a column vector. This is more efficient
   * than computing the inverse in one-shot cases.
   */
  Vector3 solve33(Vector3 b) {
    Vector3 x = new Vector3();
    solve33ToOut(b, x);
    return x;
  }

  /**
   * Solve A * x = b, where b is a column vector. This is more efficient
   * than computing the inverse in one-shot cases.
   * out: the result
   */
  void solve33ToOut(Vector3 b, Vector3 out) {
    Vector3.crossToOut(col2, col3, out);
    num det = Vector3.dot(col1, out);
    if (det != 0.0){
      det = 1.0 / det;
    }

    Vector3.crossToOut(col2, col3, out);
    final num x = det * Vector3.dot(b, out);
    Vector3.crossToOut(b, col3, out);
    final num y = det * Vector3.dot(col1, out);
    Vector3.crossToOut(col2, b, out);
    num z = det * Vector3.dot(col1, out);
    out.x = x;
    out.y = y;
    out.z = z;
  }
}
</pre>
</div>
<div>
<h3>Constructors</h3>
<div class="method"><h4 id="Matrix33">
<button class="show-code">Code</button>
new <strong>Matrix33</strong>() <a class="anchor-link" href="#Matrix33"
              title="Permalink to Matrix33.Matrix33">#</a></h4>
<div class="doc">
<pre class="source">
Matrix33() :
  col1 = new Vector3(),
  col2 = new Vector3(),
  col3 = new Vector3() { }
</pre>
</div>
</div>
<div class="method"><h4 id="Matrix33.setCols">
<button class="show-code">Code</button>
new <strong>Matrix33.setCols</strong>(<a href="../box2d_html/Vector3.html">Vector3</a> argCol1, <a href="../box2d_html/Vector3.html">Vector3</a> argCol2, <a href="../box2d_html/Vector3.html">Vector3</a> argCol3) <a class="anchor-link" href="#Matrix33.setCols"
              title="Permalink to Matrix33.Matrix33.setCols">#</a></h4>
<div class="doc">
<pre class="source">
Matrix33.setCols(Vector3 argCol1, Vector3 argCol2, Vector3 argCol3) :
  col1 = new Vector3.copy(argCol1),
  col2 = new Vector3.copy(argCol2),
  col3 = new Vector3.copy(argCol3) { }
</pre>
</div>
</div>
</div>
<div>
<h3>Static Methods</h3>
<div class="method"><h4 id="mul">
<button class="show-code">Code</button>
<a href="../box2d_html/Vector3.html">Vector3</a> <strong>mul</strong>(<a href="../box2d_html/Matrix33.html">Matrix33</a> A, <a href="../box2d_html/Vector3.html">Vector3</a> v) <a class="anchor-link" href="#mul"
              title="Permalink to Matrix33.mul">#</a></h4>
<div class="doc">
<pre class="source">
static Vector3 mul(Matrix33 A, Vector3 v){
  return new Vector3(v.x * A.col1.x + v.y * A.col2.x + v.z + A.col3.x,
      v.x * A.col1.y + v.y * A.col2.y + v.z * A.col3.y,
      v.x * A.col1.z + v.y * A.col2.z + v.z * A.col3.z);
}
</pre>
</div>
</div>
<div class="method"><h4 id="mulToOut">
<button class="show-code">Code</button>
void <strong>mulToOut</strong>(<a href="../box2d_html/Matrix33.html">Matrix33</a> A, <a href="../box2d_html/Vector3.html">Vector3</a> v, <a href="../box2d_html/Vector3.html">Vector3</a> out) <a class="anchor-link" href="#mulToOut"
              title="Permalink to Matrix33.mulToOut">#</a></h4>
<div class="doc">
<pre class="source">
static void mulToOut(Matrix33 A, Vector3 v, Vector3 out){
  final num tempy = v.x * A.col1.y + v.y * A.col2.y + v.z * A.col3.y;
  final num tempz = v.x * A.col1.z + v.y * A.col2.z + v.z * A.col3.z;
  out.x = v.x * A.col1.x + v.y * A.col2.x + v.z + A.col3.x;
  out.y = tempy;
  out.z = tempz;
}
</pre>
</div>
</div>
</div>
<div>
<h3>Properties</h3>
<div class="field"><h4 id="col1">
<button class="show-code">Code</button>
final <a href="../box2d_html/Vector3.html">Vector3</a>         <strong>col1</strong> <a class="anchor-link"
            href="#col1"
            title="Permalink to Matrix33.col1">#</a>
        </h4>
        <div class="doc">
<pre class="source">
final Vector3 col1;
</pre>
</div>
</div>
<div class="field"><h4 id="col2">
<button class="show-code">Code</button>
final <a href="../box2d_html/Vector3.html">Vector3</a>         <strong>col2</strong> <a class="anchor-link"
            href="#col2"
            title="Permalink to Matrix33.col2">#</a>
        </h4>
        <div class="doc">
<pre class="source">
final Vector3 col2;
</pre>
</div>
</div>
<div class="field"><h4 id="col3">
<button class="show-code">Code</button>
final <a href="../box2d_html/Vector3.html">Vector3</a>         <strong>col3</strong> <a class="anchor-link"
            href="#col3"
            title="Permalink to Matrix33.col3">#</a>
        </h4>
        <div class="doc">
<pre class="source">
final Vector3 col3;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="runtimeType">
<button class="show-code">Code</button>
final Type         <strong>runtimeType</strong> <a class="anchor-link"
            href="#runtimeType"
            title="Permalink to Matrix33.runtimeType">#</a>
        </h4>
        <div class="inherited-from">inherited from Object </div><div class="doc">
<p>A representation of the runtime type of the object.</p>
<pre class="source">
external Type get runtimeType;
</pre>
</div>
</div>
</div>
<div>
<h3>Operators</h3>
<div class="method inherited"><h4 id="==">
<button class="show-code">Code</button>
bool <strong>operator ==</strong>(other) <a class="anchor-link" href="#=="
              title="Permalink to Matrix33.operator ==">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>The equality operator.</p>
<p>The default behavior for all <code>Object</code>s is to return true if and
only if <code>this</code> and 
<span class="param">other</span> are the same object.</p>
<p>If a subclass overrides the equality operator it should override
the <code>hashCode</code> method as well to maintain consistency.</p>
<pre class="source">
bool operator ==(other) =&gt; identical(this, other);
</pre>
</div>
</div>
</div>
<div>
<h3>Methods</h3>
<div class="method inherited"><h4 id="hashCode">
<button class="show-code">Code</button>
int <strong>hashCode</strong>() <a class="anchor-link" href="#hashCode"
              title="Permalink to Matrix33.hashCode">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Get a hash code for this object.</p>
<p>All objects have hash codes. Hash codes are guaranteed to be the
same for objects that are equal when compared using the equality
operator <code>==</code>. Other than that there are no guarantees about
the hash codes. They will not be consistent between runs and
there are no distribution guarantees.</p>
<p>If a subclass overrides <code>hashCode</code> it should override the
equality operator as well to maintain consistency.</p>
<pre class="source">
external int hashCode();
</pre>
</div>
</div>
<div class="method"><h4 id="Matrix33">
<button class="show-code">Code</button>
new <strong>Matrix33</strong>() <a class="anchor-link" href="#Matrix33"
              title="Permalink to Matrix33.Matrix33">#</a></h4>
<div class="doc">
<pre class="source">
Matrix33() :
  col1 = new Vector3(),
  col2 = new Vector3(),
  col3 = new Vector3() { }
</pre>
</div>
</div>
<div class="method"><h4 id="Matrix33.setCols">
<button class="show-code">Code</button>
new <strong>Matrix33.setCols</strong>(<a href="../box2d_html/Vector3.html">Vector3</a> argCol1, <a href="../box2d_html/Vector3.html">Vector3</a> argCol2, <a href="../box2d_html/Vector3.html">Vector3</a> argCol3) <a class="anchor-link" href="#Matrix33.setCols"
              title="Permalink to Matrix33.Matrix33.setCols">#</a></h4>
<div class="doc">
<pre class="source">
Matrix33.setCols(Vector3 argCol1, Vector3 argCol2, Vector3 argCol3) :
  col1 = new Vector3.copy(argCol1),
  col2 = new Vector3.copy(argCol2),
  col3 = new Vector3.copy(argCol3) { }
</pre>
</div>
</div>
<div class="method inherited"><h4 id="noSuchMethod">
<button class="show-code">Code</button>
<strong>noSuchMethod</strong>(String name, List args) <a class="anchor-link" href="#noSuchMethod"
              title="Permalink to Matrix33.noSuchMethod">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p><code>noSuchMethod</code> is invoked when users invoke a non-existant method
on an object. The name of the method and the arguments of the
invocation are passed to <code>noSuchMethod</code>. If <code>noSuchMethod</code>
returns a value, that value becomes the result of the original
invocation.</p>
<p>The default behavior of <code>noSuchMethod</code> is to throw a
<code>noSuchMethodError</code>.</p>
<pre class="source">
external Dynamic noSuchMethod(String name, List args);
</pre>
</div>
</div>
<div class="method inherited"><h4 id="Object">
<button class="show-code">Code</button>
const <strong>Object</strong>() <a class="anchor-link" href="#Object"
              title="Permalink to Matrix33.Object">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Creates a new <code>Object</code> instance.</p>
<p><code>Object</code> instances have no meaningful state, and are only useful
through their identity. An <code>Object</code> instance is equal to itself
only.</p>
<pre class="source">
const Object();
</pre>
</div>
</div>
<div class="method"><h4 id="setZero">
<button class="show-code">Code</button>
void <strong>setZero</strong>() <a class="anchor-link" href="#setZero"
              title="Permalink to Matrix33.setZero">#</a></h4>
<div class="doc">
<pre class="source">
void setZero() {
  col1.setZero();
  col2.setZero();
  col3.setZero();
}
</pre>
</div>
</div>
<div class="method"><h4 id="solve22">
<button class="show-code">Code</button>
<a href="../box2d_html/Vector.html">Vector</a> <strong>solve22</strong>(<a href="../box2d_html/Vector.html">Vector</a> b) <a class="anchor-link" href="#solve22"
              title="Permalink to Matrix33.solve22">#</a></h4>
<div class="doc">
<p>Solve A * x = b, where b is a column vector. This is more efficient
than computing the inverse in one-shot cases.</p>
<pre class="source">
Vector solve22(Vector b) {
  Vector x = new Vector();
  solve22ToOut(b, x);
  return x;
}
</pre>
</div>
</div>
<div class="method"><h4 id="solve22ToOut">
<button class="show-code">Code</button>
void <strong>solve22ToOut</strong>(<a href="../box2d_html/Vector.html">Vector</a> b, <a href="../box2d_html/Vector.html">Vector</a> out) <a class="anchor-link" href="#solve22ToOut"
              title="Permalink to Matrix33.solve22ToOut">#</a></h4>
<div class="doc">
<p>Solve A * x = b, where b is a column vector. This is more efficient
than computing the inverse in one-shot cases.</p>
<pre class="source">
void solve22ToOut(Vector b, Vector out) {
  final num a11 = col1.x, a12 = col2.x, a21 = col1.y, a22 = col2.y;
  num det = a11 * a22 - a12 * a21;
  if (det != 0.0){
    det = 1.0 / det;
  }
  out.x = det * (a22 * b.x - a12 * b.y);
  out.y = det * (a11 * b.y - a21 * b.x);
}
</pre>
</div>
</div>
<div class="method"><h4 id="solve33">
<button class="show-code">Code</button>
<a href="../box2d_html/Vector3.html">Vector3</a> <strong>solve33</strong>(<a href="../box2d_html/Vector3.html">Vector3</a> b) <a class="anchor-link" href="#solve33"
              title="Permalink to Matrix33.solve33">#</a></h4>
<div class="doc">
<p>Solve A * x = b, where b is a column vector. This is more efficient
than computing the inverse in one-shot cases.</p>
<pre class="source">
Vector3 solve33(Vector3 b) {
  Vector3 x = new Vector3();
  solve33ToOut(b, x);
  return x;
}
</pre>
</div>
</div>
<div class="method"><h4 id="solve33ToOut">
<button class="show-code">Code</button>
void <strong>solve33ToOut</strong>(<a href="../box2d_html/Vector3.html">Vector3</a> b, <a href="../box2d_html/Vector3.html">Vector3</a> out) <a class="anchor-link" href="#solve33ToOut"
              title="Permalink to Matrix33.solve33ToOut">#</a></h4>
<div class="doc">
<p>Solve A * x = b, where b is a column vector. This is more efficient
than computing the inverse in one-shot cases.
out: the result</p>
<pre class="source">
void solve33ToOut(Vector3 b, Vector3 out) {
  Vector3.crossToOut(col2, col3, out);
  num det = Vector3.dot(col1, out);
  if (det != 0.0){
    det = 1.0 / det;
  }

  Vector3.crossToOut(col2, col3, out);
  final num x = det * Vector3.dot(b, out);
  Vector3.crossToOut(b, col3, out);
  final num y = det * Vector3.dot(col1, out);
  Vector3.crossToOut(col2, b, out);
  num z = det * Vector3.dot(col1, out);
  out.x = x;
  out.y = y;
  out.z = z;
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="toString">
<button class="show-code">Code</button>
String <strong>toString</strong>() <a class="anchor-link" href="#toString"
              title="Permalink to Matrix33.toString">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Returns a string representation of this object.</p>
<pre class="source">
external String toString();
</pre>
</div>
</div>
</div>
        </div>
        <div class="clear"></div>
        </div>
        
        <div class="footer">
          
        </div>
        <script async src="../client-live-nav.js"></script>
        </body></html>
        
